package main;

import java.io.IOException;
import java.lang.reflect.Method;
import java.util.*;

import letsjava.utils.*;

public class NSMain {
	public static String rootPath = System.getProperty("user.dir");

	public static void main(String[] args) {
		try {
			System.out.println("Begin processing");
			
			Scanner sca=new Scanner(System.in);
			while(true){
				System.out.println("\n----Start excute----");
				System.out.print("Input class name:");
				String classname=sca.nextLine();
				
				if("exit".equals(classname)){
					System.out.println(">bye");
					break;
				}
				
				System.out.print("Input method name:");
				String method=sca.nextLine();
				
				System.out.print("Input param:");
				String param=sca.nextLine();
				//System.out.println("你输入内容是:"+classname+method+param);
				
				
				Class<?> demo=null;
		        try{
		            demo=Class.forName(classname);
		            Object per=demo.newInstance();
		            Method methodInvoke=demo.getMethod(method, new Class[]{String.class}); 
		            System.out.println("execute result:");
		            System.out.println(methodInvoke.invoke(per, param));
		           
		            
		        } catch (Exception e) {
		            // TODO Auto-generated catch block
		            e.printStackTrace();
		        }
			}
 
			System.out.println("End processing");
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}
/*
 * 
 * //NSDBFile db = new NSDBFile(rootPath+"/data/b.txt"); NSTemplateList<Integer>
 * a = new NSTemplateList<Integer>(); a.add(1); a.add(2); a.popLast();
 * System.out.println(a.toString());
 * 
 * //NSFile.deleteFile(rootPath+"/data/b.txt"); //System.out.println(N);
 */

